package com.c2.service.impl;

import com.c2.entity.EbUser;
import com.c2.mapper.UserMapper;
import com.c2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


    @Service
    public class UserServiceImpl implements UserService {
        @Autowired
        private UserMapper userMapper;

        @Override
        public List<EbUser> listByPage(int page, int pageSize) {
            int from = (page-1)*pageSize;
            return userMapper.findByPage(from,pageSize);
        }

        @Override
        public Integer getMaxPage(Integer pageSize) {

            return userMapper.getMaxPage(pageSize);
        }

        @Override
        public int deleteByPk(String euUserId) {
            return userMapper.delete(euUserId);


        }

        @Override
        public int updateById(EbUser ebUser){
            return userMapper.updateByPrimaryKey(ebUser);
        }
        @Override
        public EbUser select(String euUserId){
            return userMapper.selectOne(euUserId);
        }
       @Override
        public EbUser Login(String euUserId,String euPassword){
            return userMapper.inquire(euUserId,euPassword);
        }
        @Override
        public  Integer save(EbUser ebUser){
            System.out.println(ebUser);
            return  userMapper.save(ebUser);
        }
    }


